Start sketching in routing functions.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 22 Oct 2002 19:04:41 +0000 (19:04 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 22 Oct 2002 19:04:41 +0000 (19:04 +0000)
gpsbabel/route.c

index 8365348cb771bc979f72c9ece2a043ee0c8d472e..7614b8bd894e3cc5ab2fabdb7b515732fe96e516 100644 (file)
 #include <stdio.h>
 #include "defs.h"
 
-static queue route_head;
+static queue my_route_head;
 
 void
 route_init(void)
 {
-       QUEUE_INIT(&route_head);
+       QUEUE_INIT(&my_route_head);
 }
 
+
+route_head *
+route_head_alloc(void)
+{
+       route_head *rte_head;
+       rte_head = xmalloc(sizeof (*rte_head));
+       QUEUE_INIT(&rte_head->Q);
+
+}
+
+
 void
-route_add(waypoint *wpt)
+route_add_head(route_head *rte)
 {
-       ENQUEUE_TAIL(&route_head, &wpt->Q);
+       ENQUEUE_TAIL(&my_route_head, &rte->Q);
+       QUEUE_INIT(&rte->waypoint_list);
 }
 
 void
-route_disp_all(waypt_cb cb)
+route_add_wpt(route_head *rte, waypoint *wpt)
 {
-       queue *elem, *tmp;
-       waypoint *waypointp;
+       ENQUEUE_TAIL(&rte->waypoint_list, &wpt->Q);
+}
 
-       QUEUE_FOR_EACH(&route_head, elem, tmp) {
+void
+route_disp (route_head *rh)
+{
+       queue *elem, *tmp;
+       printf("NEW ROUTE\n");
+       QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) {
+               waypoint *waypointp;
                waypointp = (waypoint *) elem;
-               (*cb)(waypointp);
+                       waypt_disp(waypointp);
+       }
+               
+}      
+void 
+route_disp_all()
+{
+       queue *elem, *tmp;
+       QUEUE_FOR_EACH(&my_route_head, elem, tmp) {
+               route_head *rh;
+               rh = (route_head *) elem;
+               route_disp(rh);
        }
 }